import request from '@/utils/request'
export function getNewsList(page) {
  return request({
    url: '/back/plat/sysMessage',
    method: 'get',
    params: { type: 'list', page }
  })
}
export function withDrawMessage(id) {
  return request({
    url: '/back/plat/sysMessage',
    method: 'get',
    params: { type: 'delete', id }
  })
}
export function setNewsItem({ title, center }) {
  return request({
    url: '/back/plat/sysMessage',
    method: 'post',
    params: { type: 'add', title, center }
  })
}
export function setProtocal({ type, registerRule, buyRule, serveRule }) {
  return request({
    url: '/back/plat/setRule',
    method: 'post',
    data: { type, registerRule, buyRule, serveRule }
  })
}
export function getProtocal() {
  return request({
    url: '/back/plat/setRule',
    method: 'post',
    params: { type: 'list' }
  })
}
export function setPayment({ appid, mchid, key, appsecret, sslcert_path, sslkey_path }) {
  return request({
    url: '/back/plat/payConfig',
    method: 'post',
    data: { appid, mchid, key, appsecret, sslcert_path, sslkey_path }
  })
}
/*
{
	"index_show": "dynamic",//底部导航栏商城在前还是动态在前 shop商城  dynamic 动态
	"theme_color":"#000000",//主题颜色
	"assistant_theme_color":"#ffffff",//副主题颜色
	"service_tel":"",//服务电话
	"name":"这是测试用的",//项目名称
	"logo":"",//Logo
	"classify_style":"",//动态显示的样式，1或者2
	"is_show":1,//是否显示视频模块
	"index_advertising":"",//登录页广告图
	"memu":[
	    {
	        "id":1,//第几条 1开始.
	        "icon":"",//未点击状态的图标
	        "icon_on":"",//点击状态的图标
	    },
	],
}
*/
export function setPlatform({ is_show, index_show, memu, theme_color, assistant_theme_color, name, logo, index_advertising, service_tel, shop_set }) {
  return request({
    url: '/back/terrace/setting',
    method: 'post',
    data: { is_show, index_show, memu, theme_color, assistant_theme_color, name, logo, index_advertising, service_tel, type: 'add', shop_set },
    params: { type: 'setSetting' }
  })
}
export function getPlatform() {
  return request({
    url: '/back/terrace/setting',
    method: 'get',
    params: { type: 'getSetting' }
  })
}
export function setMessage({ accesskeyid, accesskeysecret, sign_name, templat_code }) {
  return request({
    url: '/back/plat/smsConfig',
    method: 'post',
    data: { accesskeyid, accesskeysecret, sign_name, templat_code }
  })
}
export function setMiniProm({ app_id, app_secret }) {
  return request({
    url: '/api/back/plat/appletConfig',
    method: 'post',
    data: { app_id, app_secret }
  })
}
